//1.引入http组件
let http = require('http');

//2.创建服务器
 let server = http.createServer((req,res)=>{    
    //屏蔽/favicon.ico
    if(req.url=='/favicon.ico'){
        return; 
     }
    // console.log('111')
     console.log(req.url);
    //解决中文乱码
    res.setHeader('Content-type','text/html;charset=utf-8')
    if(req.url=='/' || req=='/index'){
        res.end('<h1>首页</h1>')
    }else if(req.url=='/login'){
        res.end('登入')
    }else if(req.url=='/register'){
        res.end('注册')
    }else if(req.url=='/product'){
        res.end('产品列表')
    }else if(req.url=='/order'){
        res.end('订单列表')
    }else{
        res.end('404')
    }

    // res.end('测试')
})

//3.绑定端口
server.listen(80,'www.123123.com',()=>{
    // console.log('123')
});